/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package chat.MsgEvent;

import java.util.EventObject;

/**
 *
 * @author spider391Tang
 */
public class PostEvent extends EventObject {
    //Student1 post a msg '101': "This is a test".
    //Note that the server broadcasts the message "/post Student1 101 This is a test.".

    int id;
    String author;
    String postMsg;

    public String getAuthor() {
        return author;
    }

    public String getPostMsg() {
        return postMsg;
    }

    public int getId() {
        return id;
    }

    public PostEvent(String msg) {
        super(msg);
        String[] names = msg.split(" ");
        author = names[0];
        id = Integer.parseInt(names[1]);
        postMsg = msg.substring(names[0].length() + 1 + names[1].length() + 1);

    }
}
